package com.yunxi.service.localService.vehicle.impl;

import com.github.pagehelper.PageInfo;
import com.yunxi.core.service.ServiceImplPlus;
import com.yunxi.core.util.BeanTools;
import com.yunxi.dao.vehicle.VehicleProductMapper;
import com.yunxi.model.vehicle.VehicleProduct;
import com.yunxi.service.localService.vehicle.VehicleProductService;
import com.yunxi.vehicle.pojo.VehicleProductVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 生产车型 服务实现类
 * </p>
 *
 * @author caoYong
 * @since 2019-05-11
 */
@Service
public class VehicleProductServiceImpl extends ServiceImplPlus<VehicleProductMapper, VehicleProduct> implements VehicleProductService {

   @Autowired
   VehicleProductMapper vehicleProductMapper;

   @Override
   public PageInfo<VehicleProduct> findPageByVO(VehicleProductVO vehicleProductVO, Integer pageNum, Integer pageSize)  {
      PageInfo pageInfo = pageByVo(vehicleProductVO, pageNum, pageSize);
      return pageInfo;
   }

   @Override
   public void del(VehicleProductVO vehicleProductVO) {
      VehicleProduct vehicleProduct = new VehicleProduct();
      BeanTools.copyProperties(vehicleProduct,vehicleProductVO);
      vehicleProduct.setIsDel(1);
      baseMapper.updateById(vehicleProduct);
   }

   @Override
   public List productList() {
      return vehicleProductMapper.productList();
   }

   @Override
   public void removeByListVoCus(List<VehicleProductVO> list) {
      if(list!=null&&list.size()>0){
         for(int i=0;i<list.size();i++){
            VehicleProductVO vo = list.get(i);
            del(vo);
         }
      }
   }
}
